package xian.woniu.web.controller;

import org.springframework.web.bind.annotation.*;
import xian.woniu.entity.User;
import xian.woniu.service.IUserService;
import xian.woniu.util.ResultVO;


import java.util.Map;

@RestController
@RequestMapping("user")
public class UserController {
    private IUserService userService;

    public UserController(IUserService userService) {
        this.userService = userService;
    }
    @PostMapping("passdoctor")
    public ResultVO passDoctor(@RequestBody User user){
        userService.updateUser(user);
        return ResultVO.success("审核通过");
    }

    @PostMapping("findAll")
    public ResultVO findAll(){
        return ResultVO.success(userService.findAll());
    }

    @PostMapping("findByFlag")
    public ResultVO findByFlag(@RequestBody Integer flag){
        return ResultVO.success(userService.findByFlag(flag));
    }

    @PostMapping("updateFlag")
    public ResultVO updateFlag(@RequestBody User user){
        userService.updateFlag(user);
        return ResultVO.success("解聘成功");
    }
}
